Telegram Group & Telegram Channel
Напишите линейную регрессию на Python с нуля

Это один из самых простых алгоритмов. Он включает следующие шаги:
1️⃣ Инициализация параметров.
2️⃣ Вычисление предсказаний.
3️⃣ Вычисление функции потерь.
4️⃣ Обновление параметров с помощью градиентного спуска.
5️⃣ Повторение до сходимости.
import numpy as np

class LinearRegression:
def __init__(self, learning_rate=0.01, n_iters=1000):
self.learning_rate = learning_rate
self.n_iters = n_iters

def fit(self, X, y):
n_samples, n_features = X.shape
self.weights = np.zeros(n_features)
self.bias = 0

for _ in range(self.n_iters):
model_preds = self.predict(X)
dw = (1 / n_samples) * np.dot(X.T, (model_preds - y))
db = (1 / n_samples) * np.sum(model_preds - y)

self.weights -= self.learning_rate * dw
self.bias -= self.learning_rate * db

def predict(self, X):
return np.dot(X, self.weights) + self.bias


#машинное_обучение
#программирование
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/ds_interview_lib/273
Create:
Last Update:

Напишите линейную регрессию на Python с нуля

Это один из самых простых алгоритмов. Он включает следующие шаги:
1️⃣ Инициализация параметров.
2️⃣ Вычисление предсказаний.
3️⃣ Вычисление функции потерь.
4️⃣ Обновление параметров с помощью градиентного спуска.
5️⃣ Повторение до сходимости.

import numpy as np

class LinearRegression:
def __init__(self, learning_rate=0.01, n_iters=1000):
self.learning_rate = learning_rate
self.n_iters = n_iters

def fit(self, X, y):
n_samples, n_features = X.shape
self.weights = np.zeros(n_features)
self.bias = 0

for _ in range(self.n_iters):
model_preds = self.predict(X)
dw = (1 / n_samples) * np.dot(X.T, (model_preds - y))
db = (1 / n_samples) * np.sum(model_preds - y)

self.weights -= self.learning_rate * dw
self.bias -= self.learning_rate * db

def predict(self, X):
return np.dot(X, self.weights) + self.bias


#машинное_обучение
#программирование

BY Библиотека собеса по Data Science | вопросы с собеседований


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/ds_interview_lib/273

View MORE
Open in Telegram


Библиотека собеса по Data Science | вопросы с собеседований Telegram | DID YOU KNOW?

Date: |

How To Find Channels On Telegram?

There are multiple ways you can search for Telegram channels. One of the methods is really logical and you should all know it by now. We’re talking about using Telegram’s native search option. Make sure to download Telegram from the official website or update it to the latest version, using this link. Once you’ve installed Telegram, you can simply open the app and use the search bar. Tap on the magnifier icon and search for a channel that might interest you (e.g. Marvel comics). Even though this is the easiest method for searching Telegram channels, it isn’t the best one. This method is limited because it shows you only a couple of results per search.

Why Telegram?

Telegram has no known backdoors and, even though it is come in for criticism for using proprietary encryption methods instead of open-source ones, those have yet to be compromised. While no messaging app can guarantee a 100% impermeable defense against determined attackers, Telegram is vulnerabilities are few and either theoretical or based on spoof files fooling users into actively enabling an attack.

Библиотека собеса по Data Science | вопросы с собеседований from tw


Telegram Библиотека собеса по Data Science | вопросы с собеседований
FROM USA